AmigaSoc UK
Installing NetBSD

Installing NetBSD on the Amiga is very different from most other software installations, firstly there is no installer, but as long as you have a basic knowledge of the command line, you will find it relatively straightforward. The installation can be broken up into a number of distinct steps as follows.

1 Back Up Your Hard Drive
The first thing you will need to do is back up your hard disk. This is because you will need to repartition your hard drive into at least 4 partitions to install NetBSD. Unless you are installing NetBSD onto a new drive or unused partition this will result in data loss and you could find yourself having to reinstall the Amiga Operating System as well.

2 Repartition Hard Drive
Once you have backed up your hard disk you are ready to repartition it. NetBSD requires a minimum of 3 partitions, but if you have the disk space can create more. At this stage it is wise to plan how much space you wish to devote to NetBSD and how much disk space you wish to keep on for the AmigaOS. NetBSD has some minimum requirements for disk space without which you will not have enough space to install the entire distribution. As you will be unable to change the disk partitions at a later date without a complete re-install of NetBSD it is better to get it right first time. The space requirements for NetBSD are shown below, please remember that these are the bare minimum you can get away with, and more disk space should be used if it is available.

PartitionMinimum SizeMinimum Size with XSuggested Size
root (/)10 Megabytes10 Megabytes15 Megabytes
swap
2 Megabytes for every Megabyte RAM
user (/usr)45 Megabytes80 Megabytes100 Megabytes
local (/local)
Any spare disk capacity

The /local file system is not required for NetBSD to operate, however it is usually used for users home directories and any extra software you may choose to install. The amount of disk space you allocate to /local depends on how much space you have spare, how many users your system will have and how much extra software you intend on installing. As the /local filesystem is not part of the base NetBSD distribution it is possible to add it or change it's size at a later date.
Once you have planned your disk layout you must partition your hard disk accordingly using a Hard Disk management utility. I am using Hard Disk Toolkit as it is supplied on the AmigaOS distribution, but any suitable disk utility will do. First create 3 (or more) extra partitions on your drive. You may need to delete the original (AmigaDos) partition to do this if your drive previously consisted of a single partition. Don't forget to create an AmigaDos partition as well, usually the first partition on the disk, or you won't be able to boot!. You may not be able to create you new partitions to the exact sizes you had planned on, so make them as near as possible. Do not leave any space on the drive unused as this will be wasted, unless you have future plans for it.


Disk partitioned for NetBSD. The first partition is a 500Mbyte AmigaDos partition. The following partitions are NetBSD partitions destined to become root, swap, usr and local

Important: As you create each partition make a note of it's name and the values in the Start Cyl and End Cyl boxes. This will simplify the installation process later on.

Once the drive has been partitioned we need to modify the partitions that NetBSD is going to use. Click on the check box to enable the advanced options and give each partition a name: root, swap, user and local are obvious choices. Click the Change... box to alter the file system type and make the following changes to all NetBSD partitions.

File System = Custom File System
Automount This Partition = No
Reserved blocks at beginning = 0
Reserved blocks at end = 0
Use custom boot code = No

The values for Mask, MaxTransfer and File System Block Size do not need to be changed.
The value for the Identifier field must be set to one of the following values depending on the type of NetBSD partition.

PartitionIdentifier
root0x4e425207
swap0x4e425301
others0x4e425507

Important: You must remember to press the enter key after entering the values in the Identifier field, otherwise Hard Disk Toolkit may not accept your changes.
Once all the changes to the disk have be completed you can save them to disk by using the Add/Update... button


Changes to the Disk Partition for the root filesystem

3 Obtain the NetBSD Distribution Files
Once you repartitioned your hard drive and re-installed AmigaDos (if necessary) the next step is to download all of the files required to install NetBSD onto your Amiga. Unless you have a direct Internet connection this may pose quite a challenge. The complete distribution occupies almost 25Megabytes and even if you only download the files required to get a basic system you are still looking at over 12 Megabyes of data. A removable media device such as a zip drive will provide an easier means of file transfer than floppy disks. Likewise downloading the entire distribution via modem should not be attempted unless you are not paying the phone bill.
The files needed to install NetBSD are listed below. They can all be found in the Amiga subdirectory of the
ftp sites.It is recomended that you place all the files in a NetBSD sub directory of your hard disk.

Required Files
Files(s)SizeDescription
miniroot/inst-12.fs4.1 MbInstallation File-System image
utils/xstreamtodev23 kUtility to copy File-System Image to NetBSD disk partition
kernel/netbsd1.1 MbNetBSD Kernel Image (see note)
binary/base12/base12.*12 MbBinary Base Distribution
binary/etc12/etc12.*69 kSystem Configuration Files
Optional Files
Files(s)SizeDescription
binary/games12/games12.*2.8 MbBinary Games Distribution
binary/man12/man12.*900 kMan Pages
binary/misc12/misc12.*1.8 MbSystem Dictionaries and Platform Dependant Man Pages
binary/text12/text12.*776 k Binary Text Processing Tools
binary/comp12/comp12.*5.2 MbBinary Compilation Tools
utils/rdbinfo20 kUtility to show disk partitioning information

You must also have ixemul.library installed in order to run loadbsd. The latest version can be found on the
aminet

Note:If you only have 1MB of chip-RAM you will not be able to use the generic kernel and will have to use the smaller kernel file from NetBSD 1.0

If you are using a MS-DOS format disk to transfer files you must take care that filename corruption does not occur. The majority of the filenames conform to the 8.3 limit imposed by MS-DOS. Particular care must be taken with the Binary Distribution Sets as the file extension determines the order in which the NetBSD installation script calls the files.

4 Copy File-System Image to NetBSD Disk
In order to install NetBSD you must copy a cut-down version or miniroot onto the swap partition. You can then boot into this cut down version of NetBSD, which contains just enough functionality to allow you to install a basic system. A utility is provided to copy the installation File-System onto the swap device. To copy the miniroot to the swap partition use the following command

xstreamtodev --input=inst-12.fs --rdb-name=<swap>

where <swap> is the name you gave to the swap partition created in step 2. If xstreamtodev is unable to determine the SCSI driver device name or the unit number of the specified partition you can also include the following options to the above command.

--device=<driver.name>
--unit=<SCSI_unit_number>

After a few moments xstreamtodev will print some information about the swap partition, similar to that shown below and ask you if you want to copy the file to the specified device.

found partition: "swap" capacity: 141.9 Megs
start block: 1097720 end block: 1388399 total blocks: 290680
block size: 512
dumping to: start block: 1097720 to end block: 1388399 [size: 145339K]

write from file "inst-12.fs" to partition "swap"? [Ny]:

After answering yes xstreamtodev will report on which blocks of the swap partition it is writing to and give a percentage figure. This figure refers to the amount of swap space used and not to the size of the file being copied. Do not worry if xstreamtodev stops before reaching 100%.

Note: On my system xstreamtodev seemed to have problems locating the swap device when I had a CD ROM loaded. Removing the CD from the drive solved the problem.

5 Boot into NetBSD miniroot
Once the miniroot filesystem image has been copied to the swap partition we can boot NetBSD. This will enable us to install a permanant filesystem on the root and user partitions. To boot into the miniroot use the command

loadbsd -b netbsd

If AmigaDos complains about loadbsd not being an executable file you may need to set the "Execute" protection bit with the command

protect loadbsd add e

With luck the screen will clear and display some system information as the kernel configures the hardware. Eventually you will be presented with the following prompt.

root device>

At this prompt you should enter the device that contains the swap partition you created in step 2. This will usually be sd0*, however it can be easily confirmed by looking at the output produced a few seconds previously when NetBSD booted. My NetBSD boot sequence produces the following output relating to my hard drive.

sd0 at scsibus 0 targ 0 lun 0 <SEAGATE, ST31230N, 0510> SCSI2 0/direct fixed
sd0:1010MB, 3992 cyl, 5 head, 103 sec 512 bytes/sec


Whatever your disk is configured as you must remember to put a * after the device name.
If you system hangs after entering the root device try again using loadbsd -I ff -b netbsd to disable synchronous transfer on all SCSI devices.

Eventually you will be asked to choose a shell, just hit return to accept the default shell.

Enter pathname of shell or RETURN for sh:

You will then be greeted with a welcome message and asked if you wish to precede with the installation. This is the point of no return as NetBSD will create filesystems on the disk partitions created earlier in the next few steps. If the hard drive is not partitioned correctly it is possible that it contents may be completely scrambled by the installation procedure. If you are sure you want to proceed enter "y" at the prompt.
NetBSD will then ask you which device you wish to use as a root device and offer you a choice of suitable root drives. If not choices are offered it is likely that the partition "identifier" has not been set correctly for the root partition and you should use Hard Disk Toolkit to change it to the correct value. Assuming the drive is partitioned correctly you should be presented with something similar to the output below.

The following root devices are available on your machine:
sd0

which device would you like to install on ? [sd0]


There should only be one root device so hitting <enter> at the prompt will accept this device. You will be asked to confirm that you wish to install NetBSD on this drive.

The root device you have chosen is on: sd0

THIS IS YOUR LAST CHANCE
(answering yes will format you root partition on sd0)

Are you SURE you want NetBSD installed on your hard drive ? (yes/no)


The installation program will now create a filesystem on this partition. This will produce an error complaining that newfs was unable to rewrite the disk label. This error occurs every time newfs is run and can be safely ignored.

newfs: ioctl (WDINFO): Invalid argument
newfs: /dev/rsd0a: can't rewrite disk label


You will then be asked which drive you want you /usr partition on. This will usually be the same drive as root, unless you have chosen to install NetBSD onto multiple hard disks.

What drive do you want /usr on ? sd0

Next you will be asked which partition you wish to use as /usr. You will be presented with a listing like the one shown below. You should choose the letter of the partition that corresponds to the "user" partition.

      size   offset  fstype  [fsize  bsize  cpg]
a    62400  1035320  4.2BSD    1024  8192    0    # (Cyl. 1991-2110)
b   290680  1097720    swap                       # (Cyl. 2111-2669)
c  2069600        0  unused       0     0         # (Cyl. 0-3979)
d  1034280     1040    ADOS                       # (Cyl. 2-1990)
e   274040  1388400  4.2BSD    1024  8192    0    # (Cyl. 2670-3196)
f   407160  1662440  4.2BSD    1024  8192    0    # (Cyl. 3197-3979)

If you only created a root, swap and user partition then the user partition will be the 4.2BSD partition that isn't the root partition. The root partition is usually the first partition on the list, but it's letter can be found by looking at the error produced by newfs in the last step. If like me you created a local partition as well then you will have three 4.2BSD partitions listed. The easiest way to distinguish which partition is which is to refer to the list of Start and End Cylinders you made when repartitioning the disk in step 2. This can be compared against the values listed in the last column to iden tify each partition. If you did not make a note of the Start and End cylinders then you will have to use the size column to identify the partitions. Note that the sizes are given in disk blocks and not Megabytes.

Note: Partition "c" represents the entire hard disk and should never be used as it could destroy all NetBSD and AmigaDos information present on the disk.

Once you have chosen the partition NetBSD will format and mount your user partition.

6 Install NetBSD files onto disk
Almost all that remains now is to install the files that comprise the NetBSD distribution into the correct directories. To do this we must first mount the AmigaDOS partition they were copied to in step 3 so NetBSD can see the files. This is achieved using the mount_ados command. Assuming you only have 1 AmigaDOS partition you would use the command

mkdir /mnt/ados
mount_ados -o ro /dev/sd0d /mnt/ados


If you have more than one AmigaDOS partition you may need to use the command disklabel sd0 to determine which partition to mount. To change directory to your AmigaDOS disk type

cd /mnt/ados

You can now use the ls command to view the contents of your amiga disk.
Note: The Amiga File System has been mounted read only so you can't accidentally delete files.

You should now use the cd command to change to the directory you saved the NetBSD distribution files in. The steps you should take from now on depend upon how you saved the NetBSD files and how much of the distribution you intend to install. For the sake of completeness I shall assume that a full installation will be attempted and each NetBSD file set has been installed in it's own subdirectory.
Use the cd command to change to the directory that contains the base distribution, base12. Now run the Set_tmp_dir command and choose the default temporary directory by hitting <return> when prompted. To extract the base distribution use the Extract command with the name of the base set as it's sole argument.

Extract base12

You will be asked if you wish to view the files as they are extracted, which I recommend answering "yes" to as it allows you to monitor the progress of the Extract script.
If the Extract script should fail to work there are 2 possible reasons why. If Extract reports that it cannot find thre distribution set it could be that you have spelt the name of the distribution incorrectly. Remember NetBSD is case sensitive, so "Base12" is different from "base12". It is also possible that you have not used the Set_tmp_dir command, in which case you should execute it and then try the extract again.
If Extract stops before it should with an error message similar to premature end of file than it is possible that you either have files missing from the distribution set or that in transferring them from the Internet their filenames have become scrambled. You can check the latter by using the command

echo $base12.*

The filenames should be listed in alphabetical order of the 2 letters after the dot. i.e base12.aa, base12.ab ... base12.az, base12.ba, etc. If this is not the case you will need to reboot into AmigaDos and rename all of the affected files, and then re-start the installation process from step 5.
Assuming the Extract command has completed successfully the same process can be used on all the other distribution sets. If you copied all the files into a single directory then all you need to do now is type

Extract Distribution_Set_Name

This should be done for each set you wish to install. A minimum of base12 and etc12 must be installed for NetBSD to boot. The other sets are recommended but not required for a functional system.
If like me you copied each distribution set into it's own directory you must first change to that directory before running the Set_tmp_dir and Extract commands. To change up a level in NetBSD use two dots (..). Thus to leave the base12 directory you would use the command

cd ..

For each distribution set you wish to install you must then cd into that directory and run the Extract command, i.e.

cd etc12
Set_tmp_dir
Extract Distribution_Set_name

7 Configure Your System
Once you have installed all of the distribution sets that you want onto your hard drive you are ready to configure your machine. You must have at least the Base and Etc distribution sets installed at this point. To configure your system run the command Configure at the command prompt. The Configure utility is an interactive script that will ask you the following questions and use your answers to make changes to certain files on your machine.

What is this machines hostname ? [unknown.host.domain]

This is probably the hardest part of the installation. You must now choose a name for your machine. The complete hostname for the machine is of the form Machine-Name.Organisation-Name.Domain-Name. If your machine is going to be on the internet then the Organisation Name and Domain Name will have already be chosen for you. If, however, you only intend to use your machine at home and don't have a network card you can use any name you want. I have chosen to call my machine "Amy" and have given it the full name of amy.amigasoc.org.

What domain is this machine in (this is NOT it's YP domain name) ? [host.domain]

This is usually the same answer as the first question, minus the machine name. i.e. amigasoc.org

You are then presented with the following message

WARNING: A default sendmail.cf exists, and probably needs to be tuned and/or replaced to work properly at your site.

If your machine is not on a network you can safely ignore this message. If your machine is on a network and you plan to use it to send or receive email then you will need to change the sendmail.cf to the one in use at your site.

Does this machine have an ethernet interface ? [y]

Unless you have an ethernet card installed you should enter "n" for this question. You have now finished configuring your system. The installation script will now configure your system using the answers you have given it. If you do have an ethernet card installed you will be presented with the following further questions

What is the primary interface name ? [e.g. ae0, ed0, le0 or es0]
What is the hostname for this interface ? [unknown.host.domain]
What is the IP address associated with interface le0 ?
Does this interface have a special netmask ? [n]
What is the netmask ? [0xffffff00]
Does this interface need additional flags ? [n]
What flags ? [link0]

WARNING: if you have any more ethernet interfaces, you will have to configure them by hand. Read the comments in /etc/netstart to learn how to do this.

Once configure has finished setting up your machine you must copy the kernel from the miniroot file-system to the root filesystem. This can be done with the command

cp /netbsd /mnt/netbsd

You should now halt NetBSD and reboot. To halt NetBSD use the command

halt

Note:You must always shutdown NetBSD using the halt command before you turn your amiga off or reboot it.

8 Final Tuning
Re-boot into NetBSD using the command

loadbsd netbsd

Once again you will be prompted for the pathname of a shell. Press return to use sh. You must now mount the filesystems you created in step 5 using the command

mount -av

You also need to mount your AmigaDOS partition and copy the kernel image from your NetBSD distribution to the root file system. To mount the AmigaDos filesystem use the mount_ados command.

mount_ados -o ro /dev/sd0d /mnt

Now copy the kernel image (netbsd) to the root (/) filesystem. Assuming you have a NetBSD subdirectory on your hard disk which contains the file netbsd you would use the command

cp /mnt/NetBSD/netbsd /

You have now finished configuring NetBSD and can unmount the filesystems and reboot

cd /
umount -av
halt


Once you have rebooted the machine you can boot into a fully functional NetBSD using the command

loadbsd -a netbsd

You should use this command every time you start NetBSD from now on. All that remains now is to customise NetBSD to suit your needs.

AmigaSoc U.K. 1997